#include <stdio.h>

int main()
{

#if 1
unsigned char bytes1[] = {0x00, 0x07, 0xa1, 0x20};
//unsigned int result = (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3];
unsigned int result = 0;

result += bytes1[0] << 24;
result += bytes1[1] << 16;
result += bytes1[2] << 8;
result += bytes1[3];
printf("result = %d\n",result);
#endif
unsigned int num = 500000;
unsigned char bytes[4];

bytes[0] = (num >> 24) & 0xFF;
bytes[1] = (num >> 16) & 0xFF;
bytes[2] = (num >> 8) & 0xFF;
bytes[3] = num & 0xFF;

printf("0=0x%02x\n",bytes[0]);
printf("0=0x%02x\n",bytes[1]);
printf("0=0x%02x\n",bytes[2]);
printf("0=0x%02x\n",bytes[3]);

}
